require "net/http"
require "uri"

class MetasploitModule < Msf::Auxiliary
    include Msf::Auxiliary::Scanner
    include Msf::Auxiliary::Report
    include Msf::Exploit::Remote::Tcp
   
    def initialize
      super(
        'Name'           => 'TP-LINK_TL-WR841N_A1eph-0',
        'Description'    => 'This module is used to scan the target site for TP-LINK TL-WR841N',
        'Author'         => 'H1T52{Aleph-0}',
        'License'        => MSF_LICENSE
      )
      deregister_options('SSL','VHOST','Proxies','RPORT')
      register_options(
        [
          OptString.new('RHOSTS', [true, 'The target HOST.Need not to set', '192.168.177.146']),
          OptString.new('PATH', [true, 'The URI path to the web application', '/'])
        ]) 
    
    end 
 
    def run
      path = datastore['PATH']
      payload = "python /home/kali/.msf4/modules/auxiliary/scanner/tp_LINK_TL_WR841N_A1eph0.py " + path.downcase + " " + datastore['RHOSTS'] + ":80"
      result = %x[ #{payload} ]
      if result.include? "good"
        print_good("Router TP-LINK TL-WR841N series vulnerabilities are detected successfully")
      else
        print_good("Router TP-LINK TL-WR841N series vulnerabilities were not detected")
      end
    end
end


